package com.zis.system.client;

import com.alibaba.fastjson.JSONObject;
import com.zis.starter.core.ResponseEntity;
import com.zis.starter.core.SearchParams;
import com.zis.system.model.Role;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient("sys-server")
public interface RoleClient {

    @RequestMapping(value = "/role/list", method = RequestMethod.POST)
    PageQuery<Role> findByPage(@RequestBody SearchParams params) throws Exception;

    @RequestMapping(value = "/role/save", method = RequestMethod.POST)
    ResponseEntity insert(@RequestBody Role model) throws Exception;

    @RequestMapping(value = "/role/update", method = RequestMethod.POST)
    ResponseEntity update(@RequestBody Role model) throws Exception;

    @RequestMapping(value = "/role/delete/{id}", method = RequestMethod.GET)
    ResponseEntity delete(@PathVariable("id") String id) throws Exception;

    @RequestMapping(value = "/role/all/json", method = RequestMethod.GET)
    ResponseEntity findAllToJSON() throws Exception;

    @RequestMapping(value = "/role/res/save", method = RequestMethod.POST)
    ResponseEntity roleResSave(@RequestBody JSONObject params) throws Exception;

    @RequestMapping(value = "/role/res/tree/{roleId}", method = RequestMethod.GET)
    ResponseEntity findRoleResTree(@PathVariable("roleId") String roleId) throws Exception;
}
